package com.heima.wemedia.controller.v1;

import com.heima.apis.wemedia.MaterialManageControllerApi;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.media.dto.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/materialmanage")
public class MaterialManageController implements MaterialManageControllerApi {

    @Autowired
    WmMaterialService materialService;
    /**
     * 分页条件查询所有
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto) {

        return materialService.findList(dto);
    }


    /**
     * 收藏图片
     * @param id
     * @return
     */
    @Override
    @GetMapping("/{id}")
    public ResponseResult collectionMaterial(@PathVariable("id") Integer id) {

        return materialService.collectionMaterial(id);
    }
}
